test: run e2e tests on pre-compiled packages - #23753
Conversation
141a25a to
c7a0cb8
Compare
f21bbb5 to
777cbfc
Compare
8000b07 to
5edbae8
Compare
e7fff1e to
30bac2c
Compare
| */ | ||
| export async function extractFile(tarball: string, filePath: string): Promise<Buffer> { | ||
| return new Promise((resolve, reject) => { | ||
| let chunks: Buffer[] | null = null; |
There was a problem hiding this comment.
Is there a reason that the chunks need defined in this block? Since its only referenced inside of the onentry closure, you should be able to just define it there correct?
There was a problem hiding this comment.
It was probably just me learning the fs/parse API. Updated 👍
| for (const packageName of Object.keys(packages)) { | ||
| if (packageName in json['dependencies']) { | ||
| json['dependencies'][packageName] = packages[packageName].version; | ||
| json['dependencies'][packageName] = packages[packageName]; |
There was a problem hiding this comment.
Since we have access to the version in findPackageTars can we keep using the version instead?
| ], | ||
| string: ['devkit', 'glob', 'ignore', 'reuse', 'ng-tag', 'tmpdir', 'ng-version'], | ||
| number: ['nb-shards', 'shard'], | ||
| array: ['package'], |
There was a problem hiding this comment.
For the time being can we default this to ./dist/_*.tgz? The command itself is already a bit long and having to write --package=/dist/_*.tgz multiple times a day seems a bit unnecessary.
For context here's an example of the command now.
node tests/legacy-cli/run_e2e.js tests/legacy-cli/e2e/tests/build/library/lib-consumption-full-aot.ts --package=/dist/_*.tgz
alan-agius4
left a comment
There was a problem hiding this comment.
Can you please update the developers guide?
https://github.com/angular/angular-cli/blob/main/docs/DEVELOPER.md#end-to-end-tests
9f911a6 to
02e0412
Compare
| } | ||
| } | ||
|
|
||
| export const NgCLIVersion = new SemVer(packages['@angular/cli'].version); |
There was a problem hiding this comment.
Since packages is now computed from the package tars passed on the CLI there's no guarantee that it has been put into the "global variable"s when this file is first loading, so I've moved it into a method.
Previously in this PR I had this doing require(../../../....../package.json).version instead of reading it from the loaded packages. However a) that is not the same as before this PR and b) the git repo version might not be the same as the packages being tested.
|
|
f54f169 to
7b4e421
Compare
|
Updated and squashed, see diff |
| @@ -84,6 +84,7 @@ You can find more info about debugging [tests with Bazel in the docs.](https://g | |||
|
|
|||
| - Run: `node tests/legacy-cli/run_e2e.js` | |||
There was a problem hiding this comment.
Can you add a line here that now running yarn build needs to be ran prior to node tests/legacy-cli/run_e2e.js as the latter will not build the packages.
The NPM packages being tested must be pre-compiled and the tar packages specified via --package. This way the real packages such as snapshots, release artifacts or cached packages can be tested. Previously the e2e tests compiled and packaged during test execution.
7b4e421 to
684170c
Compare
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The NPM packages to test must be specified via --package instead of invoking the build from within the e2e tests
This means the packages must be built before tested. This will align with bazel which will pass the bazel built (and cached) tgz files. The packages being tested could be the real npm packages before being published, although CI will probably test snapshot-like packages.